package com.example.jack.community.view.dynamic;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;

import com.example.jack.community.R;
import com.example.jack.community.view.dynamic.dynamic_bean.ContentData;
import com.example.jack.community.view.dynamic.dynamic_bean.ContentRecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

public class fragment_dynamic_comment extends AppCompatActivity {

    private RecyclerView community_recyclerview;
    private List<ContentData> dataList = new ArrayList<>();
    private LinearLayoutManager layoutManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_dynamic_comment);

        initRecyclerView();
        initCommunityData();
    }

    private void initRecyclerView() {
        community_recyclerview = (RecyclerView) findViewById(R.id.community_recyclerView);
        layoutManager = new LinearLayoutManager(this);
        community_recyclerview.setLayoutManager(layoutManager);
        Log.d("dataList", dataList.size() + "");
        ContentRecyclerViewAdapter adapter = new ContentRecyclerViewAdapter(dataList);
        community_recyclerview.setAdapter(adapter);
    }

    private void initCommunityData() {
        for (int i = 0; i < 10; i++) {
            ContentData num1 = new ContentData(R.drawable.tang, "袁镇轩", "2015年1月13日", "23424",
                    "在火车上邻座是个女孩，她的头发很香，也很长。恰好遮住她的脸，她假装靠在我肩膀睡觉，可是我知道她没有睡着。她的右边口袋里装着带着我体温的500快钱，而她不知道我的裤兜里也装着她刚买的iPhoneX");
            dataList.add(num1);
        }
    }

}
